// import axios from '../js/axios'
let trafficTrends
let TrafficTrend = JSON.parse(localStorage.getItem('TrafficTrend'))
let xAxisData = []
let k0view_cnt = []
let k0user_cnt = []
let k0active_user_cnt = []
  if (localStorage.getItem('TrafficTrend')) {
    for (let i = 0; i < TrafficTrend.data.length; i++) {
      xAxisData.push(TrafficTrend.data[i].g0accessdate)
      k0view_cnt.push(TrafficTrend.data[i].k0view_cnt)
      k0user_cnt.push(TrafficTrend.data[i].k0user_cnt)
      k0active_user_cnt.push(TrafficTrend.data[i].k0active_user_cnt)
    }
    trafficTrends = {
      title: {
        text: '流量趋势',
        left: 20,
        textStyle: {
          color: '#5db1ff',
        }
      },
      tooltip: {
        trigger: 'axis'
      },
      grid: {
        left: '5%',
        right: '4%',
        bottom: '5%',
        containLabel: true
      },
      color: ['#2ce790', '#5db1ff', '#ff7e75'],
      xAxis: {
        type: 'category',
        boundaryGap: false,
        data: xAxisData
      },
      yAxis: {
        type: 'value'
      },
      series: [{
        name: '访问量',
        type: 'line',
        data: k0view_cnt
      },
      {
        name: '访问用户数',
        type: 'line',
        data: k0user_cnt
      },
      {
        name: '活跃用户数',
        type: 'line',
        data: k0active_user_cnt
      },
      ]
    }
  }


export default trafficTrends